package com.ers.service;

import java.util.List;

import com.ers.dao.JobDao;
import com.ers.model.Job;
import com.ers.model.Record;
import com.ers.model.User;
import com.ers.validmodel.JobSearchModel;

public class JobService {
	private JobDao jobDao;

	public JobDao getJobDao() {
		return jobDao;
	}

	public void setJobDao(JobDao jobDao) {
		this.jobDao = jobDao;
	}
	
	public void publishJob(Job job){
		jobDao.save(job);
	}

	public List<Object[]> searchJob(JobSearchModel searchModel,int pageSize,int pageNo) {
		return jobDao.findBySearcher(searchModel,pageSize,pageNo);
	}

	public Job findById(int id) {
		return jobDao.findById(id);
	}

	public List<Job> findAll(int companyId,int pageSize,int pageNo) {
		return jobDao.findAll(companyId,pageSize,pageNo);
	}

	public void updateJob(Job job) {
		jobDao.updateJob(job);
	}

	public void delete(int id) {
		jobDao.delete(id);
	}

	public void collect(int jobId, int userId) {
		jobDao.collectJobByUser(jobId,userId);
	}

	public boolean apply(int companyId, int userId,int jobId) {
		return jobDao.applyJob(companyId,userId,jobId);
	}

	public List<Record> loadApplyiedjob(int id) {
		return jobDao.loadApplyiedjob(id);
	}

	public User loadCollectedjob(int id) {
		return jobDao.loadCollectedjob(id);
	}

	public void updateHot(int id) {
		jobDao.updateHot(id);
	}
}
